/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */
package com.poltman.dscentral.db.service.dspace.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.poltman.dscentral.db.entity.dspace.EpersongroupEntity;
import com.poltman.dscentral.db.exceptions.RepositoryAccessException;
import com.poltman.dscentral.db.exceptions.RepositoryException;
import com.poltman.dscentral.db.repository.dspace.EpersongroupRepository;
import com.poltman.dscentral.db.service.dspace.EpersongroupService;

/**
 * 
 * @author z.ciok@poltman.com
 * 
 */
@Repository
@Service("epersongroupService")
public class EpersongroupServiceImpl implements EpersongroupService {
	
	private static Logger log = Logger.getLogger(EpersongroupServiceImpl.class);
	
	@Autowired
	private EpersongroupRepository epersongroupRepository;
	
	@Override
	public EpersongroupEntity findByEpersonGroupId(Integer epersonGroupId) throws RepositoryAccessException, RepositoryException {
		if (!epersongroupRepository.exists(epersonGroupId)) return null;
		return epersongroupRepository.findByEpersonGroupId(epersonGroupId);
	}
	
	@Override
	public EpersongroupEntity findByName(String name) throws RepositoryAccessException, RepositoryException {
		return epersongroupRepository.findByName(name);
	}
}
